<?php
//---- Script to display a PHP class or lib manual using the Manta doc (Mdoc) class ----//
require("./config.php");

// Load required Manta classes
if ($force_php4 
    || version_compare(phpversion(), "5") < 0) {
  $mantalibpath = dirname(__FILE__) . "/../include/php4/";
} else {
  error_reporting(E_STRICT);  // hide PHP5 Strict Standards message until rewritting classes
  $mantalibpath = dirname(__FILE__) . "/../include/php5/";
}
require($mantalibpath. "Mdoc.php");
require($mantalibpath. "Mtest.php");

// Define a basic error handler to capture errors when necessary
function capture_error($errno, $errstr, $errfile, $errline) {
  
  // Store error data into a global variable
  global $error;
  $error = array('errno' => $errno , 
                 'errstr' => $errstr, 
                 'errfile' => $errfile, 
                 'errline' => $errline 
           );
}

// Create a Mtest instance
$testor = new Mtest();

// Set paths to class samples and references
$samples = "./samples";

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>phpManta - Mdoc - Test suite</title>
</head>

<body>
<h1>Mdoc test suite</h1>
<?php

// New test -------------------------------------------------------------------- //
$testor->new_test("error on input file doesn't exist");
// -- call te constructor with a wrong filename (PHP error must be capture) 
$error = "none";
set_error_handler("capture_error");
$manual_1 = new Mdoc("/root/whatever/Class1.php");
restore_error_handler();
// --
$testor->add_tracker("Error", &$error);
$testor->check_is_equal(E_USER_ERROR,
                        $error['errno']);
$testor->check_in_string("/file .* doesn't exist/",
                         $error['errstr'], 
                         MTEST_REGEX);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing CVS keywords");
// -- build the documentation for the CVS test class and compare the "cvs" branch
// -- with its reference imprint
$manual_1 = new Mdoc("{$samples}/Class2.php");
$cvs_branch = $manual_1->get_tree('cvs');
$cvs_string = var_export($cvs_branch, true);
// --
$message_1 = "Class2 CVS keywords parsing doesn't match expected result." .
             "<br />-- current hash is " . md5($cvs_string);
$testor->add_tracker($message_1, &$cvs_branch);
$testor->check_is_equal(md5($cvs_string) == "9aae12eaf62ca3dc15c5e1a59e4df1d9",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing class main documentation");
// -- build the documentation for the test class and compare the "main" branch
// -- with its reference imprint
$manual_1 = new Mdoc("{$samples}/Class1.php");
$main_branch = $manual_1->get_tree('main');
$main_string = var_export($main_branch, true);
// --
$message_1 = "Class1 main parsing don't match expected result.<br />" .
             "<br />-- current Class1 main hash is " . md5($main_string);
$testor->add_tracker($message_1, &$main_string);
$testor->check_is_equal(md5($main_string) == "64da7783943d7cd106bbbeb5071c0fc0",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing library main documentation");
// -- build the documentation for the test library and compare the "main" branch
// -- with its reference imprint
$manual_1 = new Mdoc("{$samples}/Lib1.php");
$main_branch = $manual_1->get_tree('main');
$main_string = var_export($main_branch, true);
// --
$message_1 = "Lib1 main parsing don't match expected result.<br />" .
             "<br />-- current Lib1 main hash is " . md5($main_string);
$testor->add_tracker($message_1, &$main_string);
$testor->check_is_equal(md5($main_string) == "61baacda38573f30dbfc944b966691dc",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing constants documentation");
// -- build the documentation for the constants test class and compare the 
// -- "constant" branch with its reference imprint
$manual_1 = new Mdoc("{$samples}/Class3.php");
$const_branch = $manual_1->get_tree('constant');
$const_string = var_export($const_branch, true);
// --
$message_1 = "Class3 constants parsing doesn't match expected result." .
             "<br />-- current hash is " . md5($const_string);
$testor->add_tracker($message_1, &$const_branch);
$testor->check_is_equal(md5($const_string) == "69834449a6fbe1fc13369d39ac82d98e",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing constant groups documentation");
// -- build the documentation for the constants test class and compare the 
// -- "constant_group" branch with its reference imprint
$manual_1 = new Mdoc("{$samples}/Class3.php");
$constgroup_branch = $manual_1->get_tree('constant_group');
$constgroup_string = var_export($constgroup_branch, true);
// --
$message_1 = "Class3 constant groups parsing doesn't match expected result." .
             "<br />-- current hash is " . md5($constgroup_string);
$testor->add_tracker($message_1, &$constgroup_branch);
$testor->check_is_equal(md5($constgroup_string) == "a256ce0c0c9f7f097ec019fea2a18163",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing methods documentation");
// -- build the documentation for the methods test class and compare the 
// -- "method" branch with its reference imprint
$manual_1 = new Mdoc("{$samples}/Class4.php");
$meth_branch = $manual_1->get_tree('method');
$meth_string = var_export($meth_branch, true);
// --
$message_1 = "Class4 methods parsing doesn't match expected result." .
             "<br />-- current hash is " . md5($meth_string);
$testor->add_tracker($message_1, &$meth_branch);
$testor->check_is_equal(md5($meth_string) == "76414436b7d1e1e6ba14a2a8cb9c9bc5",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing functions (library) documentation");
// -- build the documentation for the functions test library and compare the 
// -- "function" branch with its reference imprint
$manual_1 = new Mdoc("{$samples}/Lib1.php");
$func_branch = $manual_1->get_tree('function');
$func_string = var_export($func_branch, true);
// --
$message_1 = "Lib1 functions parsing doesn't match expected result." .
             "<br />-- current hash is " . md5($func_string);
$testor->add_tracker($message_1, &$func_branch);
$testor->check_is_equal(md5($func_string) == "98443eb50811209edf646b64d60abaf8",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing properties (PHP5 syntax) documentation");
// -- build the documentation for the properties test PHP5 class and compare the 
// -- "property" branch with its reference imprint
$manual_1 = new Mdoc("{$samples}/Class5.php");
$prop_branch = $manual_1->get_tree('property');
$prop_string = var_export($prop_branch, true);
// --
$message_1 = "Class5 properties parsing doesn't match expected result." .
             "<br />-- current hash is " . md5($prop_string);
$testor->add_tracker($message_1, &$prop_branch);
$testor->check_is_equal(md5($prop_string) == "4024e17e699152d5375ec0c1ffcec0b2",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing properties (PHP4 syntax) documentation");
// -- build the documentation for the properties test PHP4 class and compare the 
// -- "property" branch with its reference imprint
$manual_1 = new Mdoc("{$samples}/Class6.php");
$prop_branch = $manual_1->get_tree('property');
$prop_string = var_export($prop_branch, true);
// --
$message_1 = "Class6 properties parsing doesn't match expected result." .
             "<br />-- current hash is " . md5($prop_string);
$testor->add_tracker($message_1, &$prop_branch);
$testor->check_is_equal(md5($prop_string) == "9a2bfe17c97c491486c60ab5cc1c685c",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing PHP4 class");
// -- build the documentation for the test class and compare the tree with its
// -- reference imprint
$manual_1 = new Mdoc("{$samples}/Class7.php");
$root_branch = $manual_1->get_tree();
$root_string = var_export($root_branch, true);
// --
$message_1 = "Class7 parsing doesn't match expected result." .
             "<br />-- current hash is " . md5($root_string);
$testor->add_tracker($message_1, &$root_branch);
$testor->check_is_equal(md5($root_string) == "90a19070984f2a370ec4abe7353e04e8",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing PHP5 class");
// -- build the documentation for the test class and compare the tree with its
// -- reference imprint
$manual_1 = new Mdoc("{$samples}/Class1.php");
$root_branch = $manual_1->get_tree();
$root_string = var_export($root_branch, true);
// --
$message_1 = "Class1 parsing doesn't match expected result." .
             "<br />-- current hash is " . md5($root_string);
$testor->add_tracker($message_1, &$root_branch);
$testor->check_is_equal(md5($root_string) == "efa91ca02d8d0840605ffa906c598964",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing PHP5 interface");
// -- build the documentation for the interface test class and compare the tree
// -- with its reference imprint
$manual_1 = new Mdoc("{$samples}/Interface1.php");
$root_branch = $manual_1->get_tree();
$root_string = var_export($root_branch, true);
// --
$message_1 = "Interface1 parsing doesn't match expected result." .
             "<br />-- current hash is " . md5($root_string);
$testor->add_tracker($message_1, &$root_branch);
$testor->check_is_equal(md5($root_string) == "be19821260eaf399f5fc2606e0fff3d4",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing PHP5 abstract class");
// -- build the documentation for the abstract test class and compare the tree
// -- with its reference imprint
$manual_1 = new Mdoc("{$samples}/Abstract1.php");
$root_branch = $manual_1->get_tree();
$root_string = var_export($root_branch, true);
// --
$message_1 = "Abstract1 parsing doesn't match expected result." .
             "<br />-- current hash is " . md5($root_string);
$testor->add_tracker($message_1, &$root_branch);
$testor->check_is_equal(md5($root_string) == "132f2a5cf136943c1cf1178d3c45e8c9",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("parsing PHP5 final class");
// -- build the documentation for the interface test class and compare the tree
// -- with its reference imprint
$manual_1 = new Mdoc("{$samples}/Final1.php");
$root_branch = $manual_1->get_tree();
$root_string = var_export($root_branch, true);
// --
$message_1 = "Fina1 parsing doesn't match expected result." .
             "<br />-- current hash is " . md5($root_string);
$testor->add_tracker($message_1, &$root_branch);
$testor->check_is_equal(md5($root_string) == "408a5d894dc902babd302c49435a51e4",
                        true);
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("formating PHP4 class documentation");
// -- build the documentation for the test class and compare the default formated 
// -- documentation in "author" and "public" views with their reference imprints
$manual_1 = new Mdoc("{$samples}/Class4.php");
$doc_author = $manual_1->getdoc_class("author");
$doc_public = $manual_1->getdoc_class("public");
// -- force PHP_SELF URLs as if in phpManta reference folder
$self_reference = "/phpManta/Mdoc/test-suite.php";
$doc_author = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_author);
$doc_public = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_public);
// --
$ref_author = "5109d4533a46eeb67781da9f1efacf0e";
$ref_public = "6e7423e171a2e4d29b4f790892e67de8";
$message_1 = "Class4 author view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_author);
$message_2 = "Class4 public view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_public);
$testor->check_is_equal(md5($doc_author) == $ref_author, true);
$testor->check_is_equal(md5($doc_public) == $ref_public, true);
if (md5($doc_author) != $ref_author) {
  $testor->add_tracker($message_1, &$doc_author);
}
if (md5($doc_public) != $ref_public) {
  $testor->add_tracker($message_2, &$doc_public);
}
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("formating PHP5 class documentation");
// -- build the documentation for the test class and compare the default formated 
// -- documentation in "author" and "public" views with their reference imprints
$manual_1 = new Mdoc("{$samples}/Class1.php");
$doc_author = $manual_1->getdoc_class("author");
$doc_public = $manual_1->getdoc_class("public");
// -- force PHP_SELF URLs as if in phpManta reference folder
$self_reference = "/phpManta/Mdoc/test-suite.php";
$doc_author = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_author);
$doc_public = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_public);
// --
$ref_author = "1fe8072395f52be59a0f7f759d29dfe6";
$ref_public = "6e03751bd80301b64d5c1ef3fb8cefe5";
$message_1 = "Class1 author view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_author);
$message_2 = "Class1 public view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_public);
$testor->check_is_equal(md5($doc_author) == $ref_author, true);
$testor->check_is_equal(md5($doc_public) == $ref_public, true);
if (md5($doc_author) != $ref_author) {
  $testor->add_tracker($message_1, &$doc_author);
}
if (md5($doc_public) != $ref_public) {
  $testor->add_tracker($message_2, &$doc_public);
}
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("formating method documentation");
// -- build the documentation for the test class and compare the default formated 
// -- documentation in "author" and "public" views with their reference imprints
$manual_1 = new Mdoc("{$samples}/Class1.php");
$doc_author = $manual_1->getdoc_method("mlotdoc", "author");
$doc_public = $manual_1->getdoc_method("mlotdoc", "public");
// -- force PHP_SELF URLs as if in phpManta reference folder
$self_reference = "/phpManta/Mdoc/test-suite.php";
$doc_author = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_author);
$doc_public = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_public);
// --
$ref_author = "29231722a6ac6444618c23e72e492f89";
$ref_public = "c514f07538f7e9777b74d37a0d065228";
$message_1 = "Class1::mlotdoc author view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_author);
$message_2 = "Class1::mlotdoc public view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_public);
$testor->check_is_equal(md5($doc_author) == $ref_author, true);
$testor->check_is_equal(md5($doc_public) == $ref_public, true);
if (md5($doc_author) != $ref_author) {
  $testor->add_tracker($message_1, &$doc_author);
}
if (md5($doc_public) != $ref_public) {
  $testor->add_tracker($message_2, &$doc_public);
}
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("formating property documentation");
// -- build the documentation for the test class and compare the default formated 
// -- documentation in "author" and "public" views with their reference imprints
$manual_1 = new Mdoc("{$samples}/Class1.php");
$doc_author = $manual_1->getdoc_property("multi", "author");
$doc_public = $manual_1->getdoc_property("multi", "public");
// -- force PHP_SELF URLs as if in phpManta reference folder
$self_reference = "/phpManta/Mdoc/test-suite.php";
$doc_author = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_author);
$doc_public = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_public);
// --
$ref_author = "ea56e6babd9fb45efaa624e27bf21ba7";
$ref_public = "af95d4986162ac56edd48082ef482f5b";
$message_1 = "Class1->multi author view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_author);
$message_2 = "Class1->multi public view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_public);
$testor->check_is_equal(md5($doc_author) == $ref_author, true);
$testor->check_is_equal(md5($doc_public) == $ref_public, true);
if (md5($doc_author) != $ref_author) {
  $testor->add_tracker($message_1, &$doc_author);
}
if (md5($doc_public) != $ref_public) {
  $testor->add_tracker($message_2, &$doc_public);
}
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("formating constants documentation");
// -- build the documentation for the test class and compare the default formated 
// -- documentation in "author" and "public" views with their reference imprints
$manual_1 = new Mdoc("{$samples}/Class1.php");
$doc_author = $manual_1->getdoc_constants("author");
$doc_public = $manual_1->getdoc_constants("public");
// -- force PHP_SELF URLs as if in phpManta reference folder
$self_reference = "/phpManta/Mdoc/test-suite.php";
$doc_author = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_author);
$doc_public = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_public);
// --
$ref_author = "5623429c3bfd61ecc49fd8bf3974972c";
$ref_public = "18c59aeb30f4669a0f99098808724541";
$message_1 = "Class1 constants author view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_author);
$message_2 = "Class1 constants public view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_public);
$testor->check_is_equal(md5($doc_author) == $ref_author, true);
$testor->check_is_equal(md5($doc_public) == $ref_public, true);
if (md5($doc_author) != $ref_author) {
  $testor->add_tracker($message_1, &$doc_author);
}
if (md5($doc_public) != $ref_public) {
  $testor->add_tracker($message_2, &$doc_public);
}
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("formating constant documentation");
// -- build the documentation for the test class and compare the default formated 
// -- documentation in "author" and "public" views with their reference imprints
$manual_1 = new Mdoc("{$samples}/Class1.php");
$doc_author = $manual_1->getdoc_constant("Class1::START", "author");
$doc_public = $manual_1->getdoc_constant("Class1::START", "public");
// -- force PHP_SELF URLs as if in phpManta reference folder
$self_reference = "/phpManta/Mdoc/test-suite.php";
$doc_author = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_author);
$doc_public = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_public);
// --
$ref_author = "b1fc84fd66b344523c242ec004d4d736";
$ref_public = "71c7aa97c9fccd81503142eb8d0df2bf";
$message_1 = "Class1::START author view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_author);
$message_2 = "Class1::START public view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_public);
$testor->check_is_equal(md5($doc_author) == $ref_author, true);
$testor->check_is_equal(md5($doc_public) == $ref_public, true);
if (md5($doc_author) != $ref_author) {
  $testor->add_tracker($message_1, &$doc_author);
}
if (md5($doc_public) != $ref_public) {
  $testor->add_tracker($message_2, &$doc_public);
}
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("formating constant group documentation");
// -- build the documentation for the test class and compare the default formated 
// -- documentation in "author" and "public" views with their reference imprints
$manual_1 = new Mdoc("{$samples}/Class1.php");
$doc_author = $manual_1->getdoc_constant_group(1, "author");
$doc_public = $manual_1->getdoc_constant_group(1, "public");
// -- force PHP_SELF URLs as if in phpManta reference folder
$self_reference = "/phpManta/Mdoc/test-suite.php";
$doc_author = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_author);
$doc_public = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_public);
// --
$ref_author = "c25f963ebfb62956376c58c24e652ef8";
$ref_public = "842ad6302bbb8a0f66f333011efc343f";
$message_1 = "Class1 constant group (1) author view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_author);
$message_2 = "Class1 constant group (1) public view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_public);
$testor->check_is_equal(md5($doc_author) == $ref_author, true);
$testor->check_is_equal(md5($doc_public) == $ref_public, true);
if (md5($doc_author) != $ref_author) {
  $testor->add_tracker($message_1, &$doc_author);
}
if (md5($doc_public) != $ref_public) {
  $testor->add_tracker($message_2, &$doc_public);
}
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("formating library documentation");
// -- build the documentation for the test library and compare the default formated 
// -- documentation in "author" and "public" views with their reference imprints
$manual_1 = new Mdoc("{$samples}/Lib1.php");
$doc_author = $manual_1->getdoc_library("author");
$doc_public = $manual_1->getdoc_library("public");
// -- force PHP_SELF URLs as if in phpManta reference folder
$self_reference = "/phpManta/Mdoc/test-suite.php";
$doc_author = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_author);
$doc_public = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_public);
// --
$ref_author = "cccdf08bb5b05dfced5cd11e5f3eb998";
$ref_public = "5d31f085d6d291dc6d5cbf188c147753";
$message_1 = "Lib1 author view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_author);
$message_2 = "Lib1 public view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_public);
$testor->check_is_equal(md5($doc_author) == $ref_author, true);
$testor->check_is_equal(md5($doc_public) == $ref_public, true);
if (md5($doc_author) != $ref_author) {
  $testor->add_tracker($message_1, &$doc_author);
}
if (md5($doc_public) != $ref_public) {
  $testor->add_tracker($message_2, &$doc_public);
}
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("formating function documentation");
// -- build the documentation for the test library and compare the default formated 
// -- documentation in "author" and "public" views with their reference imprints
$manual_1 = new Mdoc("{$samples}/Lib1.php");
$doc_author = $manual_1->getdoc_function("flotdesc", "author");
$doc_public = $manual_1->getdoc_function("flotdesc", "public");
// -- force PHP_SELF URLs as if in phpManta reference folder
$self_reference = "/phpManta/Mdoc/test-suite.php";
$doc_author = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_author);
$doc_public = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_public);
// --
$ref_author = "f893b98e705ba7475b0c37b38c43b602";
$ref_public = "a07c0203c5dcbc2ababf6b88fbddeed7";
$message_1 = "Function flotdesc() author view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_author);
$message_2 = "Function flotdesc() public view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_public);
$testor->check_is_equal(md5($doc_author) == $ref_author, true);
$testor->check_is_equal(md5($doc_public) == $ref_public, true);
if (md5($doc_author) != $ref_author) {
  $testor->add_tracker($message_1, &$doc_author);
}
if (md5($doc_public) != $ref_public) {
  $testor->add_tracker($message_2, &$doc_public);
}
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("formating constants (library) documentation");
// -- build the documentation for the test library and compare the default formated 
// -- documentation in "author" and "public" views with their reference imprints
$manual_1 = new Mdoc("{$samples}/Lib1.php");
$doc_author = $manual_1->getdoc_constants("author");
$doc_public = $manual_1->getdoc_constants("public");
// -- force PHP_SELF URLs as if in phpManta reference folder
$self_reference = "/phpManta/Mdoc/test-suite.php";
$doc_author = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_author);
$doc_public = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_public);
// --
$ref_author = "b340e0986d949c724e7ccfd978e01a44";
$ref_public = "660b4a343c52eb13b8c6cf6a2fe6e006";
$message_1 = "Lib1 constants author view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_author);
$message_2 = "Lib1 constants public view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_public);
$testor->check_is_equal(md5($doc_author) == $ref_author, true);
$testor->check_is_equal(md5($doc_public) == $ref_public, true);
if (md5($doc_author) != $ref_author) {
  $testor->add_tracker($message_1, &$doc_author);
}
if (md5($doc_public) != $ref_public) {
  $testor->add_tracker($message_2, &$doc_public);
}
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("formating constant (library) documentation");
// -- build the documentation for the test library and compare the default formated 
// -- documentation in "author" and "public" views with their reference imprints
$manual_1 = new Mdoc("{$samples}/Lib1.php");
$doc_author = $manual_1->getdoc_constant("LIBT_ERRMSG_1", "author");
$doc_public = $manual_1->getdoc_constant("LIBT_ERRMSG_1", "public");
// -- force PHP_SELF URLs as if in phpManta reference folder
$self_reference = "/phpManta/Mdoc/test-suite.php";
$doc_author = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_author);
$doc_public = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_public);
// --
$ref_author = "f3d6e75d9b5149baeaf052df0f882430";
$ref_public = "9e2e1801f35deca900833d802b1c33f4";
$message_1 = "LIBT_ERRMSG_1 author view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_author);
$message_2 = "LIBT_ERRMSG_1 public view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_public);
$testor->check_is_equal(md5($doc_author) == $ref_author, true);
$testor->check_is_equal(md5($doc_public) == $ref_public, true);
if (md5($doc_author) != $ref_author) {
  $testor->add_tracker($message_1, &$doc_author);
}
if (md5($doc_public) != $ref_public) {
  $testor->add_tracker($message_2, &$doc_public);
}
$testor->print_result();

// New test -------------------------------------------------------------------- //
$testor->new_test("formating constant group (library) documentation");
// -- build the documentation for the test library and compare the default formated 
// -- documentation in "author" and "public" views with their reference imprints
$manual_1 = new Mdoc("{$samples}/Lib1.php");
$doc_author = $manual_1->getdoc_constant_group(1, "author");
$doc_public = $manual_1->getdoc_constant_group(1, "public");
// -- force PHP_SELF URLs as if in phpManta reference folder
$self_reference = "/phpManta/Mdoc/test-suite.php";
$doc_author = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_author);
$doc_public = str_replace($_SERVER['PHP_SELF'], $self_reference, $doc_public);
// --
$ref_author = "14c448cd97a40dfc354af90a5aa0bceb";
$ref_public = "f169a791b022a18baeffba506ad6236b";
$message_1 = "Lib1 constant group (1) author view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_author);
$message_2 = "Lib1 constant group (1) public view doesn't match expected result." .
             "<br />-- current hash is " . md5($doc_public);
$testor->check_is_equal(md5($doc_author) == $ref_author, true);
$testor->check_is_equal(md5($doc_public) == $ref_public, true);
if (md5($doc_author) != $ref_author) {
  $testor->add_tracker($message_1, &$doc_author);
}
if (md5($doc_public) != $ref_public) {
  $testor->add_tracker($message_2, &$doc_public);
}
$testor->print_result();

?>
</body>
</html>
